package com.yanqu.road.entity.activity.evefeast;


import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.math.BigDecimal;

public class EveFeastItem {
    private int id;
    private int itemId;
    private int exScore;
    private int effectRound;
    private int multiple; //倍率 千分比

    @JsonIgnore
    private int temporaryScore; //临时分数
    @JsonIgnore
    private int temporaryMultiple; //临时倍率
    @JsonIgnore
    private EveFeastBlock block;


    public EveFeastItem() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getExScore() {
        return exScore;
    }

    public void setExScore(int exScore) {
        this.exScore = exScore;
    }

    public int getItemId() {
        return itemId;
    }

    public void setItemId(int itemId) {
        this.itemId = itemId;
    }

    public int getEffectRound() {
        return effectRound;
    }

    public void setEffectRound(int effectRound) {
        this.effectRound = effectRound;
    }

    public int getMultiple() {
        return multiple;
    }

    public void setMultiple(int multiple) {
        this.multiple = multiple;
    }

    @JSONField(deserialize = false, serialize = false)
    public int getTemporaryScore() {
        return temporaryScore;
    }

    @JSONField(deserialize = false, serialize = false)
    public void setTemporaryScore(int temporaryScore) {
        this.temporaryScore = temporaryScore;
    }

    @JSONField(deserialize = false, serialize = false)
    public int getTemporaryMultiple() {
        return temporaryMultiple;
    }

    @JSONField(deserialize = false, serialize = false)
    public void setTemporaryMultiple(int temporaryMultiple) {
        this.temporaryMultiple = temporaryMultiple;
    }

    public EveFeastItem clone() {
        EveFeastItem item = new EveFeastItem();
        item.setId(id);
        item.setItemId(itemId);
        item.setExScore(exScore);
        item.setEffectRound(effectRound);
        item.setMultiple(multiple);
        item.setTemporaryScore(temporaryScore);
        item.setTemporaryMultiple(temporaryMultiple);
        item.setBlock(block);
        return item;
    }

    /**
     * 物品最终雅趣值=（初始雅趣值+雅趣值增加）x（1+雅趣值加倍）
     * @return
     */
    public int calcScore() {
        int realScore = BigDecimal.valueOf(exScore + temporaryScore).
                multiply(BigDecimal.valueOf(1000 + multiple + temporaryMultiple).divide(BigDecimal.valueOf(1000), 8, BigDecimal.ROUND_UP)).setScale(0, BigDecimal.ROUND_UP).intValue();

        return realScore;
    }

    @JSONField(deserialize = false, serialize = false)
    public EveFeastBlock getBlock() {
        return block;
    }

    @JSONField(deserialize = false, serialize = false)
    public void setBlock(EveFeastBlock block) {
        this.block = block;
    }
}
